package o;

import android.text.TextUtils;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

public abstract class cmy {
    private cnh ˏ;

    protected abstract void ˋ(cne o_cne);

    public cmy(cnh o_cnh) {
        this.ˏ = o_cnh;
    }

    protected void ॱ(cne o_cne) {
        int i = 3;
        boolean z = false;
        boolean z2 = true;
        if (!TextUtils.isEmpty(o_cne.ॱ())) {
            String[] ˋ = cnr.ˋ(o_cne.ॱ());
            if (ˋ.length == 0) {
                cmp.ˊ.ˎ("AbstractDomainTask", "parse addr failed, no ip returned. key:" + o_cne.ˊ() + " addr:" + o_cne.ॱ());
            } else {
                Map hashMap = new HashMap();
                if (ˋ.length <= 3) {
                    i = ˋ.length;
                }
                int ˏ = ˏ(o_cne.ॱ());
                for (int i2 = 0; i2 < i; i2++) {
                    if (Thread.currentThread().isInterrupted()) {
                        cmp.ˊ.ˋ("AbstractDomainTask", "domain test interrupted");
                        this.ˏ.ˎ(o_cne, false);
                        return;
                    }
                    boolean ˎ = cnr.ˎ(ˋ[i2], ˏ);
                    hashMap.put(ˋ[i2], Boolean.valueOf(ˎ));
                    if (!ˎ) {
                        z2 = false;
                    }
                }
                o_cne.ˎ(hashMap);
                z = z2;
            }
        }
        this.ˏ.ˎ(o_cne, z);
    }

    private int ˏ(String str) {
        int i = 443;
        try {
            URL url = new URL(str);
            if (url.getPort() > 0) {
                i = url.getPort();
            }
        } catch (MalformedURLException e) {
            cmp.ˊ.ˊ("AbstractDomainTask", "get port failed, addr:" + str + ", exception: " + e.toString());
        }
        return i;
    }
}
